module.exports = (sequelize, DataTypes) => {
  const status = sequelize.define(
    'status',
    {
      id: {
        type: DataTypes.INTEGER(11),
        primaryKey: true,
        autoIncrement: true
      },
      statusName: {
        type: DataTypes.STRING(255),
        allowNull: false,
        field: "status-name"
      }
    },
    {
      tableName: 'status',
      timestamps: false,//使用事务时，出现Unknown column 'created_at' in 'field list'，原因是sequelize默认会自动为其添加 createdAt 和updatedAt column值，添加timestamp处理
    },
  )
  status.associate = (models) => {//定义外键关联
    status.belongsTo(
      models.electric_sale,
      {foreignKey: 'id'}
    );
  }
  return status;
};